const {selectOne} = require('../util/db-util')

async function getAuthor(id) {
    let arr = await selectOne('user', 'id', id),
        author = {
            account: arr[0].account,
            id: arr[0].id,
            portrait_id: arr[0].portrait_id,
            username: arr[0].account,
            valid: arr[0].valid
        }
    return author
}

async function getAuthorByAccount(account) {
    let arr = await selectOne('user', 'account', account)
    return arr[0]
}

module.exports = {
    getAuthor,
    getAuthorByAccount
}